Skip to content

Conversation

de-nordic
Copy link
Collaborator

@de-nordic de-nordic commented Oct 7, 2025

Add MCUBOOT_CHECK_HEADER_LOAD_ADDRESS that allows to validate application image, against boot slot, with the use of ih_img_addr from header.

There are additional commits here:

  • updating simulator allowing to parametrize generation of broken secondary slot image
  • sim test for added feature
  • Zephyr Kconfig to control MCUBOOT_CHECK_HEADER_LOAD_ADDRESS
  • Zephyr deprecate of MCUBOOT_VERIFY_IMG_ADDRESS

}

#if MCUBOOT_IMAGE_NUMBER > 1 && !defined(MCUBOOT_ENC_IMAGES) && defined(MCUBOOT_VERIFY_IMG_ADDRESS)
#if defined(MCUBOOT_VERIFY_IMG_ADDRESS) && !defined(MCUBOOT_ENC_IMAGES) || \
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

missing bracket here?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes it is. I am still testing this locally and trying to make it run with sim.

#else
/* This is platform specific code that should not be here */
const uint32_t offset = secondary_hdr->ih_hdr_size + RESET_OFFSET;
BOOT_LOG_DBG("Getting image %d internal addr from offset %u",
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

would mark this as deprecated then remove it in 2 releases

@de-nordic de-nordic force-pushed the 461 branch 4 times, most recently from b9f0b09 to f810c82 Compare October 8, 2025 13:39
Copy link
Collaborator

@nvlsianpu nvlsianpu left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@de-nordic de-nordic marked this pull request as ready for review October 8, 2025 14:49
@de-nordic de-nordic requested a review from d3zd3z as a code owner October 8, 2025 14:49
de-nordic and others added 5 commits October 8, 2025 15:20
Adding MCUBOOT_CHECK_HEADER_LOAD_ADDRESS that allows to verify
header stored ih_load_addr against target boot slot, to allow
MCUboot to reject firmware uploaded for incorrect slot.
This option works with encrypted software, as it does not require
decrypting image.
This option takes precedence over MCUBOOT_VERIFY_IMG_ADDRESS.
Note that the change leaves MCUBOOT_VERIFY_IMG_ADDRESS with the
bug reported here mcu-tools#2473.

This commit also removes dependency on having more then one image
to have the check enabled, as it makes no point to block using it
on single image.

Co-authored-by: Andrzej Puzdrowski <[email protected]>
Signed-off-by: Dominik Ermel <[email protected]>
Allows to enable MCUboot config MCUBOOT_CHECK_HEADER_LOAD_ADDRESS.

Co-authored-by: Andrzej Puzdrowski <[email protected]>
Signed-off-by: Dominik Ermel <[email protected]>
Add ImageManipulation parameter to the function to allow creating
images broken in various ways.

Signed-off-by: Dominik Ermel <[email protected]>
Testing MCUBOOT_CHECK_HEADER_LOAD_ADDRESS for non-RAM load
binaries.

Signed-off-by: Dominik Ermel <[email protected]>
Please use MCUBOOT_CHECK_HEADER_LOAD_ADDRESS instead.

Signed-off-by: Dominik Ermel <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants